﻿using Singer.Core;
using Singer.Shared.Domain;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Singer.UnitTestWeb.Domain.Users
{
    [Table("tb_userinfo")]
    public class User : IEntity<long>, ISoftDelete, ICreator, IChanger
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public long Id { get; set; }
        public string Name { get; set; }
        public string Account { get; set; }
        public int Age { get; set; }
        public string Password { get; set; } = "666";

        #region 系统字段
        [Column(TypeName = "varchar(32)")]
        public string? CreatorId { get; protected set; }
        public DateTime CreateTime { get; protected set; }
        [Column(TypeName = "varchar(32)")]
        public string? ChangerId { get; protected set; }
        public DateTime? ChangeTime { get; protected set; }
        public bool IsDeleted { get; protected set; }
        public string? DeleterId { get; protected set; }
        public DateTime? DeleteTime { get; protected set; }
        #endregion

        public User() { }

        public User(string account, string name, int age, string pwd)
        {
            Account = account;
            Name = name;
            Age = age;
            Password = pwd;
        }
    }
}
